home *** CD-ROM | disk | FTP | other *** search
/ Comix Games / Comix Games.iso / waldo / waldo.exe / FINAL08.DXR / 00256.ls < prev    next >
Encoding:
Text File  |  1995-10-08  |  11.7 KB  |  350 lines

  1. global gBigBalloon, gBDropSprite, gBalloons, gBalloonsList, gReturnFrame, gUserLevel
  2.  
  3. on demoCursor
  4.   set userH to the mouseH
  5.   set userV to the mouseV
  6.   if the frame > label("Tangram 3") then
  7.     set newLoc to point(91, 187)
  8.   else
  9.     if the frame > label("Tangram 2") then
  10.       set newLoc to point(123, 154)
  11.     else
  12.       if the frame > label("Tangram 1") then
  13.         set newLoc to point(115, 268)
  14.       else
  15.         exit
  16.       end if
  17.     end if
  18.   end if
  19.   cursor(200)
  20.   set cursorSprite to 37
  21.   set origLoc to point(userH, userV)
  22.   set the loc of sprite cursorSprite to origLoc
  23.   updateStage()
  24.   slidePiece(cursorSprite, origLoc, newLoc, 25)
  25.   puppetSprite(cursorSprite, 0)
  26.   go(the frame + 1)
  27. end
  28.  
  29. on returnCursor
  30.   set userH to the mouseH
  31.   set userV to the mouseV
  32.   set cursorSprite to 37
  33.   set origLoc to the loc of sprite cursorSprite
  34.   set newLoc to point(userH, userV)
  35.   slidePiece(cursorSprite, origLoc, newLoc, 15)
  36.   puppetSprite(cursorSprite, 0)
  37.   cursor(0)
  38.   cursor(-1)
  39.   go(the frame + 1)
  40. end
  41.  
  42. on checkNewGame
  43.   if the frame >= label("Screen Shots") then
  44.     exit
  45.   else
  46.     if the frame >= label("Tangram 3.1") then
  47.       setProp(29, 36, "puppet", 0)
  48.       go("Tangram " & gUserLevel & ".1")
  49.     else
  50.       if the frame >= label("Tangram 2.1") then
  51.         setProp(29, 36, "puppet", 0)
  52.         go("Tangram " & gUserLevel & ".1")
  53.       else
  54.         if the frame >= label("Tangram 1.1") then
  55.           setProp(29, 36, "puppet", 0)
  56.           go("Tangram " & gUserLevel & ".1")
  57.         else
  58.           if the frame >= label("Ma Barker") then
  59.             exit
  60.           else
  61.             if the frame >= label("Band 3.1") then
  62.               setProp(17, 23, "puppet", 0)
  63.               go("Band " & gUserLevel & ".1")
  64.             else
  65.               if the frame >= label("Band 3") then
  66.                 exit
  67.               else
  68.                 if the frame >= label("Band 2.1") then
  69.                   setProp(17, 23, "puppet", 0)
  70.                   go("Band " & gUserLevel & ".1")
  71.                 else
  72.                   if the frame >= label("Band 2") then
  73.                     exit
  74.                   else
  75.                     if the frame >= label("Band 1.1") then
  76.                       setProp(17, 23, "puppet", 0)
  77.                       go("Band " & gUserLevel & ".1")
  78.                     else
  79.                       if the frame < label("Flags Up") then
  80.                         go("Flags Up")
  81.                       end if
  82.                     end if
  83.                   end if
  84.                 end if
  85.               end if
  86.             end if
  87.           end if
  88.         end if
  89.       end if
  90.     end if
  91.   end if
  92. end
  93.  
  94. on movePiece whichSprite, whichSprite1, whichSprite2, numberOfPieces, snapDistance, spriteOffset1, spriteOffset2, whichSound
  95.   set userH to the mouseH
  96.   set userV to the mouseV
  97.   if the timer < 10 then
  98.     exit
  99.   end if
  100.   set userH1 to userH
  101.   set userV1 to userV
  102.   set offsetH to userH - the locH of sprite whichSprite
  103.   set offsetV to userV - the locV of sprite whichSprite
  104.   set theForeColor to the foreColor of sprite whichSprite
  105.   set activateScript to setActivateScript(whichSprite, whichSprite2)
  106.   do(activateScript)
  107.   set the foreColor of sprite whichSprite2 to theForeColor
  108.   puppetSprite(whichSprite, 1)
  109.   set the locV of sprite whichSprite to -500
  110.   updateStage()
  111.   repeat while the stillDown
  112.     set userH to the mouseH
  113.     set userV to the mouseV
  114.     set origLoc to the loc of sprite whichSprite2
  115.     set newLoc to point(userH - offsetH, userV - offsetV)
  116.     slidePiece(whichSprite2, origLoc, newLoc, 3)
  117.   end repeat
  118.   playSound(whichSound)
  119.   set gUserLevel to checkRange(gUserLevel, 1, 3)
  120.   set numberOfPlaced to 0
  121.   set numberOfMatches to 0
  122.   set numberOfPieces to getAt(numberOfPieces, gUserLevel)
  123.   set snapDistance to getAt(snapDistance, gUserLevel)
  124.   set the loc of sprite whichSprite to the loc of sprite whichSprite2
  125.   deactivate([whichSprite2])
  126.   updateStage()
  127.   if the frame >= label("Ma Barker") then
  128.     repeat with x = 1 to numberOfPieces
  129.       set whichSprite to x + spriteOffset1
  130.       if the type of sprite whichSprite > 0 then
  131.         set distanceH to abs(the locH of sprite whichSprite - the locH of sprite (whichSprite + spriteOffset2))
  132.         set distanceV to abs(the locV of sprite whichSprite - the locV of sprite (whichSprite + spriteOffset2))
  133.         if (distanceH = 0) and (distanceV = 0) then
  134.           set numberOfMatches to numberOfMatches + 1
  135.           next repeat
  136.         end if
  137.         if (distanceH <= snapDistance) and (distanceV <= snapDistance) then
  138.           slidePiece(whichSprite, the loc of sprite whichSprite, the loc of sprite (whichSprite + spriteOffset2), 3)
  139.           set numberOfMatches to numberOfMatches + 1
  140.         end if
  141.       end if
  142.     end repeat
  143.     if numberOfMatches >= numberOfPieces then
  144.       go(marker(1))
  145.     else
  146.       go(the frame)
  147.     end if
  148.     startTimer()
  149.     exit
  150.   end if
  151.   if the frame < label("Ma Barker") then
  152.     set whichSprite0 to whichSprite1 - spriteOffset2
  153.     repeat with x = whichSprite0 to whichSprite0 + numberOfPieces - 1
  154.       repeat with whichSprite = whichSprite1 to whichSprite1 + numberOfPieces - 1
  155.         if the type of sprite whichSprite > 0 then
  156.           set distanceH to abs(the locH of sprite whichSprite - the locH of sprite x)
  157.           set distanceV to abs(the locV of sprite whichSprite - the locV of sprite x)
  158.           if (distanceH = 0) and (distanceV = 0) then
  159.             set numberOfPlaced to numberOfPlaced + 1
  160.             if whichSprite = (x + spriteOffset2) then
  161.               set numberOfMatches to numberOfMatches + 1
  162.             end if
  163.             next repeat
  164.           end if
  165.           if (distanceH <= snapDistance) and (distanceV <= snapDistance) then
  166.             slidePiece(x, the loc of sprite x, the loc of sprite whichSprite, 3)
  167.             set numberOfPlaced to numberOfPlaced + 1
  168.             if whichSprite = (x + spriteOffset2) then
  169.               set numberOfMatches to numberOfMatches + 1
  170.             end if
  171.           end if
  172.         end if
  173.       end repeat
  174.     end repeat
  175.     if numberOfMatches >= numberOfPieces then
  176.       playSound("Band Win")
  177.       delayFor(10)
  178.       go(marker(1))
  179.     else
  180.       if numberOfPlaced >= numberOfPieces then
  181.         if (userH1 <> userH) or (userV1 <> userV) then
  182.           playSound("Band Lose")
  183.           delayFor(10)
  184.         end if
  185.         go(the frame)
  186.       else
  187.         go(the frame)
  188.       end if
  189.     end if
  190.     startTimer()
  191.     exit
  192.   end if
  193. end
  194.  
  195. on moveTangram whichSprite
  196.   set numberOfPieces to [4, 4, 7]
  197.   set snapDistance to [20, 15, 10]
  198.   movePiece(whichSprite, 13, 37, numberOfPieces, snapDistance, 28, -16, 0)
  199. end
  200.  
  201. on moveBand whichSprite
  202.   set numberOfPieces to [3, 4, 5]
  203.   set snapDistance to [15, 15, 15]
  204.   set newSound to "!" & the name of cast the castNum of sprite whichSprite & " Band"
  205.   movePiece(whichSprite, 10, 23, numberOfPieces, snapDistance, 16, -7, newSound)
  206. end
  207.  
  208. on slidePiece whichSprite, origLoc, newLoc, numberOfSteps
  209.   puppetSprite(whichSprite, 1)
  210.   repeat with x = 1 to numberOfSteps
  211.     set the loc of sprite whichSprite to newLoc - ((newLoc - origLoc) / x)
  212.     updateStage()
  213.   end repeat
  214.   set the loc of sprite whichSprite to newLoc
  215.   updateStage()
  216. end
  217.  
  218. on scrollWaldo userH, userV, distance
  219.   set newH to -1
  220.   set newV to -1
  221.   if userH < 10 then
  222.     set newH to checkRange(the locH of sprite gBDropSprite + distance, 205, 307)
  223.   else
  224.     if userH > 502 then
  225.       set newH to checkRange(the locH of sprite gBDropSprite - distance, 205, 307)
  226.     end if
  227.   end if
  228.   if userV < 10 then
  229.     set newV to checkRange(the locV of sprite gBDropSprite + distance, 98, 286)
  230.   else
  231.     if userV > 374 then
  232.       set newV to checkRange(the locV of sprite gBDropSprite - distance, 98, 286)
  233.     end if
  234.   end if
  235.   if newH > 0 then
  236.     set oldH to the locH of sprite gBDropSprite
  237.     set the locH of sprite gBDropSprite to newH
  238.     repeat with x = 1 to 2
  239.       set offsetH to oldH - the locH of sprite (gBDropSprite + x)
  240.       set the locH of sprite (gBDropSprite + x) to newH - offsetH
  241.     end repeat
  242.   end if
  243.   if newV > 0 then
  244.     set oldV to the locV of sprite gBDropSprite
  245.     set the locV of sprite gBDropSprite to newV
  246.     repeat with x = 1 to 2
  247.       set offsetV to oldV - the locV of sprite (gBDropSprite + x)
  248.       set the locV of sprite (gBDropSprite + x) to newV - offsetV
  249.     end repeat
  250.   end if
  251.   go(the frame)
  252. end
  253.  
  254. on waldoWave
  255.   set offsetH to the locH of sprite (gBDropSprite + 1)
  256.   set offsetV to the locV of sprite (gBDropSprite + 1)
  257.   activate(gBDropSprite + 2, "Waldo Arm", 1, 36, offsetH - 10, offsetV + 13, EMPTY, EMPTY, EMPTY)
  258.   activate(gBDropSprite + 3, "Waldo Hand 1", 1, 36, offsetH - 12, offsetV - 2, EMPTY, EMPTY, EMPTY)
  259.   set the backColor of sprite (gBDropSprite + 2) to 204
  260.   set the backColor of sprite (gBDropSprite + 3) to 204
  261.   updateStage()
  262.   repeat with x = 1 to 3
  263.     delayFor(5)
  264.     set the castNum of sprite (gBDropSprite + 3) to the number of cast "Waldo Hand 2"
  265.     set the loc of sprite (gBDropSprite + 3) to point(offsetH - 15, offsetV - 1)
  266.     updateStage()
  267.     delayFor(5)
  268.     set the castNum of sprite (gBDropSprite + 3) to the number of cast "Waldo Hand 3"
  269.     set the loc of sprite (gBDropSprite + 3) to point(offsetH - 15, offsetV - 1)
  270.     updateStage()
  271.     delayFor(5)
  272.     set the castNum of sprite (gBDropSprite + 3) to the number of cast "Waldo Hand 2"
  273.     set the loc of sprite (gBDropSprite + 3) to point(offsetH - 15, offsetV - 1)
  274.     updateStage()
  275.     delayFor(5)
  276.     set the castNum of sprite (gBDropSprite + 3) to the number of cast "Waldo Hand 1"
  277.     set the loc of sprite (gBDropSprite + 3) to point(offsetH - 12, offsetV - 2)
  278.     updateStage()
  279.   end repeat
  280.   delayFor(5)
  281.   deactivate([gBDropSprite + 2, gBDropSprite + 3])
  282.   updateStage()
  283. end
  284.  
  285. on gimmeaBalloon whichPos, whichFrame, whichBalloon, now
  286.   set gBigBalloon to 0
  287.   store([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])
  288.   if not listp(gBalloonsList) then
  289.     set gBalloonsList to [0, 0, 0, 0]
  290.   end if
  291.   if whichPos <= count(gBalloonsList) then
  292.     if (getAt(gBalloonsList, whichPos) = 0) or now then
  293.       setAt(gBalloonsList, whichPos, 1)
  294.       set gBalloons to checkRange(gBalloons + 1, 1, 4)
  295.       if whichFrame < 1 then
  296.         set gReturnFrame to the frame
  297.       else
  298.         set gReturnFrame to whichFrame
  299.       end if
  300.       if whichBalloon < 1 then
  301.         setProp(1, 40, "puppet", 1)
  302.         setProp(41, 48, "puppet", 0)
  303.         go("Balloons" & gBalloons)
  304.       else
  305.         go(the frame)
  306.       end if
  307.     end if
  308.   end if
  309. end
  310.  
  311. on gimmeaBigBalloon whichPos, whichFrame, now
  312.   if not (the commandDown) then
  313.     set gBigBalloon to whichPos
  314.     store([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])
  315.     if whichFrame < 1 then
  316.       set gReturnFrame to the frame
  317.     else
  318.       set gReturnFrame to whichFrame
  319.     end if
  320.     setProp(1, 45, "puppet", 1)
  321.     setProp(46, 48, "puppet", 0)
  322.     go("big balloon")
  323.   end if
  324. end
  325.  
  326. on gimmeaBigBalloon2 whichPos, whichFrame, now
  327.   store([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])
  328.   if not listp(gBalloonsList) then
  329.     set gBalloonsList to [0, 0, 0, 0]
  330.   end if
  331.   if whichPos <= count(gBalloonsList) then
  332.     if (getAt(gBalloonsList, whichPos) = 0) or now then
  333.       if whichFrame < 1 then
  334.         set gReturnFrame to the frame
  335.       else
  336.         set gReturnFrame to whichFrame
  337.       end if
  338.       setProp(1, 45, "puppet", 1)
  339.       setProp(46, 48, "puppet", 0)
  340.       go("big balloon")
  341.     end if
  342.   end if
  343. end
  344.  
  345. on returnBalloon
  346.   restore([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])
  347.   setProp(41, 48, "puppet", 1)
  348.   go(gReturnFrame)
  349. end
  350.